package com.zy.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.entity.Feedback;
import com.zy.mapper.FeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ZyFeedBackController {
    @Autowired
    FeedbackMapper feedbackMapper;

    /**
     * @Author: 杨深俊
     * @Method: getFeeds
     * @Date: 2021/4/7
     * @Time: 11:47
     * @Param pageNum 当前页数
     * @Param pageSize 每页记录条数
     */
    @RequestMapping("/feedBackManage")
    public ModelAndView getFeeds(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                 @RequestParam(value = "pageSize", defaultValue = "7") Integer pageSize) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("FeedBackManage");

        //意见反馈分页
        IPage<Feedback> feedBackPage = new Page<>(pageNum, pageSize);
        IPage<Feedback> feeds = feedbackMapper.selectPage(feedBackPage, null);
        modelAndView.addObject("feeds", feeds);
        //返回视图
        return modelAndView;
    }

}
